package com.rc.saas.mini.charge;

import com.rc.saas.mini.vo.printer.StartPrintReq;
import com.rc.saas.mini.vo.printer.StartPrintResult;
import com.rc.saas.mini.service.printer.ElecPrinterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wangzhengwei
 * @create 2021/4/23
 */
@Service
public class PrinterServiceImpl implements PrinterService {
    @Autowired
    private ElecPrinterService elecPrinterService;

    @Override
    public StartPrintResult assembleQueryPrintResult(StartPrintReq startPrintReq) {
        StartPrintResult startPrintResult = new StartPrintResult();
        startPrintResult.setStartChargeSeq(startPrintReq.getStartChargeSeq());

        startPrintResult.setSuccStat(0);
        startPrintResult.setFailReason(0);

        Integer count = elecPrinterService.countPrinterByOrderNum(startPrintReq.getStartChargeSeq());
        if (count != null && count <= 0) {
            startPrintResult.setSuccStat(1);
            startPrintResult.setFailReason(1);
        }
        return startPrintResult;
    }

}
